{#if loading}
{:else if !svc}
Serviço não encontrado
{:else}
← Voltar
{svc.name}
{svc.url}
{#if stats}
Uptime
{#each [ { label: '24h', uptime: stats.uptime_24h, checks: stats.total_checks_24h, avg: stats.avg_response_ms_24h }, { label: '7 dias', uptime: stats.uptime_7d, checks: stats.total_checks_7d, avg: stats.avg_response_ms_7d }, { label: '30 dias', uptime: stats.uptime_30d, checks: stats.total_checks_30d, avg: stats.avg_response_ms_30d } ] as item}
{item.label}
{item.checks} checks
{item.uptime.toFixed(2)}%
{item.avg.toFixed(0)}ms méd.
{/each}
{/if}
Tempo de Resposta (ms)
{#if history.length === 0}
Sem dados ainda
{:else if history.length === 1}
{history[0].response_time_ms}
ms
{history[0].is_up ? 'Online' : 'Offline'} — {history[0].status_code || 'timeout'}
{:else}
{#each yTicks as tick}
{tick.val}
{/each}
`${d.x},${d.y}`).join(' ')} fill="none" stroke="var(--green)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> {#each dots as d}
{/each}
{/if}
{history[0]?.tested_at ? new Date(history[0].tested_at).toLocaleTimeString() : ''}
{history[history.length - 1]?.tested_at ? new Date(history[history.length - 1].tested_at).toLocaleTimeString() : ''}
Últimas Verificações
{#each history.slice().reverse() as h}
{#if h.status_code > 0} {h.status_code} {:else} TIMEOUT {/if}
{h.response_time_ms}ms
{#if h.error_message}
(expandedError = expandedError === h.id ? null : h.id)} class="text-[10px] text-[var(--red)] underline underline-offset-2 transition-colors hover:opacity-70" > {expandedError === h.id ? '▲ erro' : '▼ erro'}
{/if}
{#if expandedError === h.id && h.error_message}
{h.error_message}
{/if}
{/each}
{/if}